package com.cnhis.cloudhealth.clidoctorweb.doctoradviceeditor;

import com.alibaba.dubbo.config.annotation.Reference;
import com.cnhis.cloudhealth.clinical.clidoctor.clinicaldoctoradviceeditor.mapper.CliVao1;
import com.cnhis.cloudhealth.clinical.clidoctor.clinicaldoctoradviceeditor.service.IDoctorAdviceEditor;
import com.cnhis.cloudhealth.commons.Mappers.ModelVo;
import com.cnhis.cloudhealth.commons.interceptor.SpringContextHolder;
import com.cnhis.cloudhealth.commons.redisdb.RedisResource;
import com.cnhis.cloudhealth.commons.utils.JsonUtil;
import org.jboss.resteasy.logging.Logger;
import org.springframework.stereotype.Component;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Path("doctoradviceeditor")
@Component
public class DoctorAdviceEditorRest
{
    Logger log = Logger.getLogger(DoctorAdviceEditorRest.class);
    
    @Reference
    private IDoctorAdviceEditor doctorAdviceEditor;
    
    private RedisResource redisResource = (RedisResource) SpringContextHolder.getBean("redisResource");
    
    
    /**
     * 771 医嘱编辑：检索项目对应执行科室
     * 
     * @param currPage
     * @param pageSize
     * @return
     * @throws Exception
     */
    @POST
    @Path("queryitemexecuteoffice")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo queryItemExecuteOffice(@FormParam("currPage") int currPage, @FormParam("pageSize") int pageSize)
        throws Exception
    {
        return doctorAdviceEditor.queryItemExecuteOffice((currPage - 1) * pageSize, pageSize);
    }
    
    /**
     * 793 医嘱编辑：用于增加病人诊断记录
     * 
     * @param VAA01 病人id
     * @param VAA07 就诊id
     * @param VAF01
     * @param ACF01 1 门诊 2 住院 3 病案
     * @param VAO06 诊断次序
     * @param VAO07 1 初步诊断 1 正常诊断
     * @param VAO10 0 西医 1 中医
     * @param VAO11 1 门诊诊断 2 入院诊断 3 出院诊断 5 医院感染 6 病例诊断 。。。
     * @param BAK01A 疾病id
     * @param CAM01 诊断id
     * @param BCE03A 记录人
     * @param VAO18 1 疑诊 其他正常
     * @param VAO22 0 其他地方诊断 1 医嘱诊断 2 记账单诊断
     * @return
     * @throws Exception
     */
    @POST
    @Path("insertpatientdiagnosticlogout")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo insertPatientDiagnosticLogout(@FormParam("VAA01") int VAA01, @FormParam("VAA07") int VAA07,
        @FormParam("VAF01") int VAF01, @FormParam("ACF01") int ACF01, @FormParam("VAO06") int VAO06,
        @FormParam("VAO07") int VAO07, @FormParam("VAO10") short VAO10, @FormParam("VAO11") short VAO11,
        @FormParam("BAK01A") int BAK01A, @FormParam("CAM01") long CAM01, @FormParam("BCE03A") String BCE03A,
        @FormParam("VAO18") short VAO18, @FormParam("VAO22") short VAO22)
        throws Exception
    {
        CliVao1 vao1 = new CliVao1();
        vao1.setVao01(doctorAdviceEditor.getId());
        vao1.setVaa01(VAA01);
        vao1.setVaa07(VAA07);
        vao1.setVaf01(VAF01);
        vao1.setAcf01(ACF01);
        vao1.setVao06(VAO06);
        vao1.setVao07(VAO07);
        vao1.setVao10(VAO10);
        vao1.setVao11(VAO11);
        vao1.setBak01a(BAK01A);
//        vao1.setCam01(CAM01);
        vao1.setBce03a(BCE03A);
        vao1.setVao18(VAO18);
        vao1.setVao22(VAO22);
        return doctorAdviceEditor.insertPatientDiagnosticLogout(vao1);
    }
    
    /* ScriptId(747) */
    /* Description(医嘱编辑窗口，用于存放医嘱记录) */
    @POST
    @Path("storagedoctoradvicerecord")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo storageDoctorAdviceRecord()
        throws Exception
    {
        return doctorAdviceEditor.storageDoctorAdviceRecord();
    }
    
    /* ScriptId(743) */
    /* Description(医嘱编辑窗口检索门诊病人信息) */
    /**
     * 
     * @param lVAA01 病人id
     * @param lVAC01 就诊id
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("queryclinicalpatientinformation")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo queryClinicalPatientinformation(@FormParam("lVAA01") int lVAA01, @FormParam("lVAC01") int lVAC01)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lVAA01", lVAA01);
        map.put("lVAC01", lVAC01);
        return doctorAdviceEditor.queryClinicalPatientinformation(map);
    }
    
    /* ScriptId(1177) */
    /* Description(用于存放医嘱中新增诊断记录) */
    /**
     * 
     * @param lVAA01 诊断记录id
     * @param lVAE01 就诊id
     * @param lVAF01 医嘱单id
     * @param lVAF01A
     * @param acf01
     * @param adate 日期
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("storagenewdiagnosisrecord")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo storageNewDiagnosisRecord(@FormParam("lVAA01") Long lVAA01, @FormParam("productId") int productId,
        @FormParam("programId") int programId, @FormParam("paramNo") int paramNo, @FormParam("lVAE01") Long lVAE01,
        @FormParam("lVAF01") Long lVAF01, @FormParam("lVAF01A") Long lVAF01A, @FormParam("acf01") int acf01
        )
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lVAA01", lVAA01);
        map.put("lVAE01", lVAE01);
        map.put("lVAF01", lVAF01);
        map.put("lVAF01A", lVAF01A);
        map.put("acf01", acf01);
        map.put("productId", 9999);
        map.put("programId", 9999);
        map.put("paramNo", 42);
        return doctorAdviceEditor.storageNewDiagnosisRecord(map);
    }
    
    @SuppressWarnings("unchecked")
    @POST
    @Path("storagenewdiagnosisrecord1")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo storageNewDiagnosisRecord1(@FormParam("lVAA01") Long lVAA01, @FormParam("productId") int productId,
        @FormParam("programId") int programId, @FormParam("paramNo") int paramNo, @FormParam("lVAE01") Long lVAE01,
        @FormParam("lVAF01") Long lVAF01, @FormParam("lVAF01A") Long lVAF01A, @FormParam("acf01") int acf01
        )
            throws Exception
    {
        HashMap map = new HashMap();
        map.put("lVAA01", lVAA01);
        map.put("lVAE01", lVAE01);
        map.put("lVAF01", lVAF01);
        map.put("lVAF01A", lVAF01A);
        map.put("acf01", acf01);
        map.put("productId", 9999);
        map.put("programId", 9999);
        map.put("paramNo", 42);
        return doctorAdviceEditor.storageNewDiagnosisRecord1(map);
    }
    
    /* ScriptId(1640) */
    /* 下达医嘱时，用于显示私人常用项目列表 */
    /**
     * 
     * @param lBCE01 员工id
     * @param lBCK01 开单科室id
     * @param aACF01 业务id
     * @param bdp02 病人类别
     * @param lDate 日期 YYYY-MM-DD
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("personaloftenlist")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo personalOftenList(@FormParam("productId") int productId, @FormParam("programId") int programId,
        @FormParam("paramNo") int paramNo, @FormParam("lBCE01") int lBCE01, @FormParam("lBCK01") int lBCK01,
        @FormParam("aACF01") int aACF01, @FormParam("bdp02") String bdp02, @FormParam("lDate") String lDate,
        @FormParam("currPage") int currPage, @FormParam("pageSize") int pageSize)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lBCE01", lBCE01);
        map.put("lBCK01", lBCK01);
        map.put("aACF01", aACF01);
        map.put("bdp02", bdp02);
        map.put("lDate", new Date());
        map.put("productId", productId);
        map.put("programId", programId);
        map.put("paramNo", paramNo);
        return doctorAdviceEditor.personalOftenList(map, currPage, pageSize);
        
    }
    
    /* 下达医嘱时，用于显示私人常用项目列表--中草药 */
    /**
     * 
     * @param lBCE01 员工id
     * @param lBCK01 开单科室id
     * @param aACF01 业务id
     * @param bdp02 病人类别
     * @param lDate 日期 YYYY-MM-DD
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("personalOftenListZhongyao")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo personalOftenListZhongyao(@FormParam("productId") int productId, @FormParam("programId") int programId,
        @FormParam("lBCE01") int lBCE01, @FormParam("lBCK01") int lBCK01,
        @FormParam("aACF01") int aACF01, @FormParam("bdp02") String bdp02, @FormParam("lDate") String lDate,
        @FormParam("currPage") int currPage, @FormParam("pageSize") int pageSize)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lBCE01", lBCE01);
        map.put("lBCK01", lBCK01);
        map.put("aACF01", aACF01);
        map.put("bdp02", bdp02);
        map.put("lDate", new Date());
        map.put("productId", productId);
        map.put("programId", programId);
        return doctorAdviceEditor.personalOftenListZhongyao(map);
    }
    /* 下达医嘱时，用于显示私人常用项目列表--检查 */
    /**
     * @param lBCE01 员工id
     * @param lBCK01 开单科室id
     * @param aACF01 业务id
     * @param bdp02 病人类别
     * @param lDate 日期 YYYY-MM-DD
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("personalOftenListJiancha")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo personalOftenListJiancha(@FormParam("productId") int productId, @FormParam("programId") int programId,
        @FormParam("lBCE01") int lBCE01, @FormParam("lBCK01") int lBCK01,
        @FormParam("aACF01") int aACF01, @FormParam("bdp02") String bdp02, @FormParam("lDate") String lDate,
        @FormParam("currPage") int currPage, @FormParam("pageSize") int pageSize)
            throws Exception
    {
        HashMap map = new HashMap();
        map.put("lBCE01", lBCE01);
        map.put("lBCK01", lBCK01);
        map.put("aACF01", aACF01);
        map.put("bdp02", bdp02);
        map.put("lDate", new Date());
        map.put("productId", productId);
        map.put("programId", programId);
        return doctorAdviceEditor.personalOftenListJiancha(map);
    }
    /* 下达医嘱时，用于显示私人常用项目列表--西、成药 */
    /**
     * 
     * @param lBCE01 员工id
     * @param lBCK01 开单科室id
     * @param aACF01 业务id
     * @param bdp02 病人类别
     * @param lDate 日期 YYYY-MM-DD
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("personalOftenListXiyao")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo personalOftenListXiyao(@FormParam("productId") int productId, @FormParam("programId") int programId,
        @FormParam("lBCE01") int lBCE01, @FormParam("lBCK01") int lBCK01,
        @FormParam("aACF01") int aACF01, @FormParam("bdp02") String bdp02, @FormParam("lDate") String lDate,
        @FormParam("currPage") int currPage, @FormParam("pageSize") int pageSize)
            throws Exception
    {
        HashMap map = new HashMap();
        map.put("lBCE01", lBCE01);
        map.put("lBCK01", lBCK01);
        map.put("aACF01", aACF01);
        map.put("bdp02", bdp02);
        map.put("lDate", new Date());
        map.put("productId", productId);
        map.put("programId", programId);
        return doctorAdviceEditor.personalOftenListXiyao(map);
    }
    /* 下达医嘱时，用于显示私人常用项目列表--检验*/
    /**
     * 
     * @param lBCE01 员工id
     * @param lBCK01 开单科室id
     * @param aACF01 业务id
     * @param bdp02 病人类别
     * @param lDate 日期 YYYY-MM-DD
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("personalOftenListJianyan")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo personalOftenListJianyan(@FormParam("productId") int productId, @FormParam("programId") int programId,
        @FormParam("lBCE01") int lBCE01, @FormParam("lBCK01") int lBCK01,
        @FormParam("aACF01") int aACF01, @FormParam("bdp02") String bdp02, @FormParam("lDate") String lDate,
        @FormParam("currPage") int currPage, @FormParam("pageSize") int pageSize)
            throws Exception
    {
        HashMap map = new HashMap();
        map.put("lBCE01", lBCE01);
        map.put("lBCK01", lBCK01);
        map.put("aACF01", aACF01);
        map.put("bdp02", bdp02);
        map.put("lDate", new Date());
        map.put("productId", 9999);
        map.put("programId", 9999);
        map.put("paramno", 15);
        return doctorAdviceEditor.personalOftenListJianyan(map);
    }
    /* 下达医嘱时，用于显示私人常用项目列表--手术 */
    /**
     * @param lBCE01 员工id
     * @param lBCK01 开单科室id
     * @param aACF01 业务id
     * @param bdp02 病人类别
     * @param lDate 日期 YYYY-MM-DD
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("personalOftenListShoushu")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo personalOftenListShoushu(@FormParam("productId") int productId, @FormParam("programId") int programId,
        @FormParam("lBCE01") int lBCE01, @FormParam("lBCK01") int lBCK01,
        @FormParam("aACF01") int aACF01, @FormParam("bdp02") String bdp02, @FormParam("lDate") String lDate,
        @FormParam("currPage") int currPage, @FormParam("pageSize") int pageSize)
            throws Exception
    {
        HashMap map = new HashMap();
        map.put("lBCE01", lBCE01);
        map.put("lBCK01", lBCK01);
        map.put("aACF01", aACF01);
        map.put("bdp02", bdp02);
        map.put("lDate", new Date());
        map.put("productId", productId);
        map.put("programId", programId);
        return doctorAdviceEditor.personalOftenListShoushu(map);
    }
    /* 下达医嘱时，用于显示私人常用项目列表--治疗 */
    /**
     * @param lBCE01 员工id
     * @param lBCK01 开单科室id
     * @param aACF01 业务id
     * @param bdp02 病人类别
     * @param lDate 日期 YYYY-MM-DD
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("personalOftenListZhiliao")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo personalOftenListZhiliao(@FormParam("productId") int productId, @FormParam("programId") int programId,
        @FormParam("lBCE01") int lBCE01, @FormParam("lBCK01") int lBCK01,
        @FormParam("aACF01") int aACF01, @FormParam("bdp02") String bdp02, @FormParam("lDate") String lDate,
        @FormParam("currPage") int currPage, @FormParam("pageSize") int pageSize)
            throws Exception
    {
        HashMap map = new HashMap();
        map.put("lBCE01", lBCE01);
        map.put("lBCK01", lBCK01);
        map.put("aACF01", aACF01);
        map.put("bdp02", bdp02);
        map.put("lDate", new Date());
        map.put("productId", productId);
        map.put("programId", programId);
        return doctorAdviceEditor.personalOftenListZhiliao(map);
    }
    /* 下达医嘱时，用于显示私人常用项目列表--卫材 */
    /**
     * @param lBCE01 员工id
     * @param lBCK01 开单科室id
     * @param aACF01 业务id
     * @param bdp02 病人类别
     * @param lDate 日期 YYYY-MM-DD
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("personalOftenListCailiao")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo personalOftenListCailiao(@FormParam("productId") int productId, @FormParam("programId") int programId,
        @FormParam("lBCE01") int lBCE01, @FormParam("lBCK01") int lBCK01,
        @FormParam("aACF01") int aACF01, @FormParam("bdp02") String bdp02, @FormParam("lDate") String lDate,
        @FormParam("currPage") int currPage, @FormParam("pageSize") int pageSize)
            throws Exception
    {
        HashMap map = new HashMap();
        map.put("lBCE01", lBCE01);
        map.put("lBCK01", lBCK01);
        map.put("aACF01", aACF01);
        map.put("bdp02", bdp02);
        map.put("lDate", new Date());
        map.put("productId", productId);
        map.put("programId", programId);
        return doctorAdviceEditor.personalOftenListCailiao(map);
    }

    private void configParamNo(HashMap map)
        throws Exception
    {
        Map param = new HashMap<String, Object>();
        param.put("productid", 9999);
        param.put("programid", 9999);
        param.put("paramno", 15);
//        String paramNo = cliParamterBo.getSysValue(param);
//        map.put("paramNo", paramNo );
    }
    
    /* ScriptId(1047) */
    /* 个人治疗方案 */
    /**
     * 
     * @param lACF01 业务id
     * @param lBCE01 员工id
     * @param lBCK01 科室id
     * @param lDate 日期
     * @param currPage
     * @param pageSize
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("personaltherapeuticregimen")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo personalTherapeuticRegimen(@FormParam("lACF01") int lACF01, @FormParam("lBCE01") int lBCE01,
        @FormParam("lBCK01") int lBCK01, @FormParam("currPage") int currPage,
        @FormParam("pageSize") int pageSize)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lACF01", lACF01);
        map.put("lBCE01", lBCE01);
        map.put("lBCK01", lBCK01);
        map.put("lDate", new Date());
        map.put("currPage", currPage);
        map.put("pageSize", pageSize);
        return doctorAdviceEditor.personalTherapeuticRegimen(map, currPage, pageSize);
    }
    /* ScriptId(7289) */
    
    /* 检验申请单组合及自定项目 */
    /**
     * 
     * @param lACF01 业务id
     * @param lBCE01 科室id
     * @param lDate 日期
     * @param currPage
     * @param pageSize
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("requestnote")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo requestNote(@FormParam("lACF01") int lACF01, @FormParam("lDate") String lDate,
        @FormParam("lBCE01") int lBCE01, @FormParam("currPage") int currPage, @FormParam("pageSize") int pageSize)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lACF01", lACF01);
        map.put("lBCE01", lBCE01);
        map.put("lDate", lDate);
        map.put("currPage", currPage);
        map.put("pageSize", pageSize);
        return doctorAdviceEditor.requestNote(map, currPage, pageSize);
    }
    /* ScriptId(7287) */
    
    /* 申请单明细项目 */
    /**
     * 
     * @param lBCE01 科室id
     * @param lACF01 业务id
     * @param lDate 日期
     * @param currPage
     * @param pageSize
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("requestnotedetailitem")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo requestNoteDetailItem(@FormParam("lBCE01") int lBCE01, @FormParam("lDate") String lDate,
        @FormParam("lACF01") int lACF01, @FormParam("currPage") int currPage, @FormParam("pageSize") int pageSize)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lACF01", lACF01);
        map.put("lBCE01", lBCE01);
        map.put("lDate", lDate);
        map.put("currPage", currPage);
        map.put("pageSize", pageSize);
        return doctorAdviceEditor.requestNoteDetailItem(map, (currPage - 1) * pageSize, pageSize);
    }
    
    /* ScriptId(7285) */
    /* 检验申请单，提取可用治疗方案 */
    /**
     * 
     * @param lACF01 业务id
     * @param lBCE01 科室id
     * @param lDate 日期
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("rapeuticschedule")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo rapeuticSchedule(@FormParam("lACF01") int lACF01, @FormParam("lDate") String lDate,
        @FormParam("lBCE01") int lBCE01)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lACF01", lACF01);
        map.put("lBCE01", lBCE01);
        map.put("lDate", lDate);
        return doctorAdviceEditor.rapeuticSchedule(map);
    }
    
    /* ScriptId(1438) */
    /* Description(按分类检索医嘱项目，树形左边列表) */
    /**
     * 
     * @param lBEH01 根码
     * @param BCE01 员工id
     * @param BCK01 科室id
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @GET
    @Path("treelist")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo treeList(@QueryParam("lBEH01") String lBEH01, @QueryParam("BCE01") int BCE01,
        @QueryParam("BCK01") int BCK01)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lBEH01", lBEH01);
        map.put("BCE01", BCE01);
        map.put("BCK01", BCK01);
        return doctorAdviceEditor.treeList(map);
    }
    
    @SuppressWarnings("unchecked")
    @GET
    @Path("treelist1")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo treeList1(@QueryParam("lBEH01") String lBEH01, @QueryParam("BCE01") int BCE01,
        @QueryParam("BCK01") String BCK01,@QueryParam("acf01") String acf01,@QueryParam("fanganshunxu") String fanganshunxu)
            throws Exception
    {
        HashMap map = new HashMap();
        map.put("lBEH01", lBEH01);
        map.put("BCE01", BCE01);
        map.put("BCK01", BCK01);
        map.put("acf01", acf01);
        map.put("fanganshunxu", fanganshunxu);
        return doctorAdviceEditor.treeList1(map);
    }
    
    /* ScriptId(1439) */
    /* Description(医嘱分类明细项目检索，按分类检索) */
    /**
     * 
     * @param lBDO01 医疗 项目分类id
     * @param lACF01 业务id
     * @param lSql '%'
     * @param lBBX09 执行频率
     * @param lBEH01 医疗项目类别 根码
     * @param lBCE01 员工id
     * @param lBCK01 科室id
     * @param abc02 病人费别
     * @param bdp02 病人类别
     * @param productId
     * @param programId
     * @param paramNo(9999,9999,60)
     * @param lDate 日期
     * @param currPage
     * @param pageSize
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("classificationretrieval")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo classificationRetrieval(@FormParam("lBDO01") int lBDO01, @FormParam("lACF01") int lACF01,@FormParam("yiyuanId") int yiyuanId,
        @FormParam("lSql") String lSql, @FormParam("lBBX09") int lBBX09, @FormParam("lBEH01") String lBEH01,
        @FormParam("lBCE01") int lBCE01, @FormParam("lBCK01") int lBCK01, @FormParam("abc02") String abc02,@FormParam("BCKyf") String BCKyf,
        @FormParam("bdp02") String bdp02, @FormParam("productId") int productId, @FormParam("programId") int programId,
        @FormParam("paramNo") int paramNo, @FormParam("lbda01") String lbda01, @FormParam("currPage") int currPage, @FormParam("pageSize") int pageSize)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lBDO01", lBDO01);
        map.put("lACF01", lACF01);
        map.put("lSql", lSql);
        map.put("lBBX09", lBBX09);
        map.put("lBEH01", lBEH01);
        map.put("lBCE01", lBCE01);
        map.put("lBCK01", lBCK01);
        map.put("abc02", abc02);
        map.put("bdp02", bdp02);
        map.put("productid", productId);
        map.put("programid", programId);
        map.put("paramno", paramNo);
        map.put("lDate", new Date());
        map.put("lbda01", lbda01);
        map.put("BCKyf", BCKyf);
        map.put("yiyuanId", yiyuanId);
        return doctorAdviceEditor.classificationRetrieval(map,currPage,pageSize);
    }
    /* ScriptId(1439) */
    /* Description(医嘱分类明细项目检索，按分类检索) */
    /**
     * 
     * @param lBDO01 医疗 项目分类id
     * @param lACF01 业务id
     * @param lSql '%'
     * @param lBBX09 执行频率
     * @param lBEH01 医疗项目类别 根码
     * @param lBCE01 员工id
     * @param lBCK01 科室id
     * @param abc02 病人费别
     * @param bdp02 病人类别
     * @param productId
     * @param programId
     * @param paramNo(9999,9999,60)
     * @param lDate 日期
     * @param currPage
     * @param pageSize
     * @return
     * @throws Exception
     */
    @SuppressWarnings({"unchecked", "rawtypes"})
    @POST
    @Path("classificationretrieval_fangan")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo classificationretrieval_fangan(@FormParam("lACF01") int lACF01,@FormParam("lBDO01") int lBDO01,
        @FormParam("lSql") String lSql, @FormParam("lBBX09") int lBBX09, @FormParam("lBEH01") String lBEH01,
        @FormParam("lBCE01") int lBCE01, @FormParam("lBCK01") int lBCK01, @FormParam("abc02") String abc02,
        @FormParam("bdp02") String bdp02, @FormParam("productId") int productId, @FormParam("programId") int programId,
        @FormParam("paramNo") int paramNo, @FormParam("lbda01") String lbda01)
            throws Exception
    {
        HashMap map = new HashMap();
        map.put("lBDO01", lBDO01);
        map.put("lACF01", lACF01);
        map.put("lSql", lSql);
        map.put("lBBX09", lBBX09);
        map.put("lBEH01", lBEH01);
        map.put("lBCE01", lBCE01);
        map.put("lBCK01", lBCK01);
        map.put("abc02", abc02);
        map.put("bdp02", bdp02);
        map.put("productid", productId);
        map.put("programid", programId);
        map.put("paramno", paramNo);
        map.put("lDate", new Date());
        map.put("lbda01", lbda01);
        return doctorAdviceEditor.classificationretrieval_fangan(map);
    }
    
    /**
     * 治疗方案检索
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("jiansuoFangan")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo jiansuoFangan(@FormParam("lSql") String lSql,  @FormParam("lBEH01") String lBEH01,
        @FormParam("lBCE01") int lBCE01, @FormParam("lBCK01") int lBCK01, @FormParam("abc02") String abc02,
        @FormParam("bdp02") String bdp02,@FormParam("lBBX09") int lBBX09, @FormParam("lbda01") String lbda01)
            throws Exception
    {
        HashMap map = new HashMap();
        map.put("lSql", lSql);
        map.put("lBBX09", lBBX09);
        map.put("lBEH01", lBEH01);
        map.put("lBCE01", lBCE01);
        map.put("lBCK01", lBCK01);
        map.put("abc02", abc02);
        map.put("bdp02", bdp02);
        map.put("lbda01", lbda01);
        return doctorAdviceEditor.jiansuoFangan(map);
    }
    
    /* ScriptId(6430) */
    /* Description(医嘱判断药房库存，按执行科室来判断) */
    /**
     * 
     * @param lBCK01 药房id
     * @param lACF01
     * @param lBBY01 -药品id
     * @param productId
     * @param programId
     * @param paramNo
     * @return
     * @throws Exception (9999,9999,15)
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("checkdrugstore")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo checkDrugstore(@FormParam("lBCK01") int lBCK01, @FormParam("lACF01") int lACF01,
        @FormParam("lBBY01") int lBBY01, @FormParam("productId") int productId, @FormParam("programId") int programId,
        @FormParam("paramNo") int paramNo)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lBCK01", lBCK01);
        map.put("lACF01", lACF01);
        map.put("lBBY01", lBBY01);
        map.put("productId", 9999);
        map.put("programId", 9999);
        map.put("paramNo", 15);
        return doctorAdviceEditor.checkDrugstore(map);
    }
    
    /**
     * wj-修改为一次查询所有药品的库存情况（避免再循环中查询数据库）
     * @param lBCK01
     * @param lACF01
     * @param lBBY01
     * @param productId
     * @param programId
     * @param paramNo
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("checkdrugstoreNew")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo checkDrugstore1(@FormParam("lACF01") int lACF01,@FormParam("bby01Arr_1") String bby01Arr_1,
        @FormParam("bby01Arr_3") String bby01Arr_3,@FormParam("bck01_x") int bck01_x,@FormParam("bck01_z") int bck01_z)
            throws Exception
    {
        HashMap map = new HashMap();
        map.put("lACF01", lACF01);
        map.put("bck01_x", bck01_x);
        map.put("bck01_z", bck01_z);
        map.put("bby01Arr_1", JsonUtil.getList(bby01Arr_1));
        map.put("bby01Arr_3", JsonUtil.getList(bby01Arr_3));
        map.put("productid", 9999);
        map.put("programid", 9999);
        map.put("paramno", 15);
        return doctorAdviceEditor.checkdrugstoreNew(map);
    }
    
    /**
     * wj-修改为一次查询所有材料的库存情况（避免再循环中查询数据库）
     * @param lBCK01
     * @param lACF01
     * @param lBBY01
     * @param productId
     * @param programId
     * @param paramNo
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("checkdrugstoreNew_cailiao")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo checkdrugstoreNew_cailiao(@FormParam("lACF01") int lACF01,
        @FormParam("bby01Arr_4") String bby01Arr_4,@FormParam("bck01_c") int bck01_c)
            throws Exception
    {
        HashMap map = new HashMap();
        map.put("lACF01", lACF01);
        map.put("bck01_c", bck01_c);
        map.put("bby01Arr_4", JsonUtil.getList(bby01Arr_4));
        map.put("productid", 9999);
        map.put("programid", 9999);
        map.put("paramno", 15);
        return doctorAdviceEditor.checkdrugstoreNew_cailiao(map);
    }
    
    /* ScriptId(1756) */
    /* Description(医嘱编辑中提取对应收费明细 适用于非药品医嘱) */
    /**
     * 
     * @param ACF01
     * @param lVAF06 就诊id
     * @param lBBX01 诊疗项目id
     * @param lVAF21
     * @param lVAF22
     * @param lBCK03
     * @param lBCK03F
     * @param BDA01
     * @param lBCK01A
     * @param lVAF32
     * @param VAF17
     * @param VAF26
     * @param VAF27
     * @param VAF28
     * @param VAF29
     * @param vaj26
     * @param vaj27
     * @param vaf58
     * @param aDate 日期
     * @param currPage
     * @param pageSize
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("queryfeedetail")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo queryFeeDetail(
        
        @FormParam("ACF01") int ACF01, @FormParam("lVAF06") long lVAF06, @FormParam("lBBX01") int lBBX01,
        @FormParam("lVAF21") String lVAF21, @FormParam("lVAF22") String lVAF22, @FormParam("lBCK03") String lBCK03,
        @FormParam("lBCK03F") String lBCK03F, @FormParam("BDA01") String BDA01, @FormParam("lBCK01A") int lBCK01A,
        @FormParam("lVAF32") int lVAF32, @FormParam("VAF17") int VAF17, @FormParam("VAF26") String VAF26,
        @FormParam("VAF27") int VAF27, @FormParam("VAF28") int VAF28, @FormParam("VAF29") String VAF29,
        @FormParam("vaj26") int vaj26, @FormParam("vaj27") int vaj27, @FormParam("vaf58") int vaf58,
        @FormParam("aDate") String aDate, @FormParam("currPage") int currPage, @FormParam("pageSize") int pageSize)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("ACF01", ACF01);
        map.put("lVAF06", lVAF06);
        map.put("lBBX01", lBBX01);
        map.put("lVAF21", lVAF21);
        map.put("lVAF22", lVAF22);
        map.put("lBCK03", lBCK03);
        map.put("lBCK03F", lBCK03F);
        map.put("BDA01", BDA01);
        map.put("lBCK01A", lBCK01A);
        
        map.put("lVAF32", lVAF32);
        map.put("VAF17", VAF17);
        map.put("VAF18", "");
        map.put("VAF26", VAF26);
        map.put("VAF27", VAF27);
        map.put("VAF28", VAF28);
        map.put("VAF29", VAF29);
        map.put("vaj26", vaj26);
        map.put("vaj27", vaj27);
        map.put("vaf58", vaf58);
        map.put("aDate", new SimpleDateFormat("YYYY-MM-dd").format(new Date()));
        return doctorAdviceEditor.queryFeeDetail(map);
    }
    
    /**
     * 725 树形：按药品规格 检索品种分类对应的明细项目
     * 
     * @param lACF01
     * @param lBDO01
     * @param lSql
     * @param lBDA01
     * @param lBCK01
     * @param BCKyf
     * @param abc02
     * @param bdp02
     * @param vaf58
     * @param currPage
     * @param pageSize
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @GET
    @Path("medtreetodetail")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo queryFeeDetail(@QueryParam("lACF01") Integer lACF01, @QueryParam("lBDO01") Integer lBDO01,@QueryParam("yiyuanId") Integer yiyuanId,
        @QueryParam("lSql") String lSql, @QueryParam("lBDA01") String lBDA01, @QueryParam("lBCK01") Integer lBCK01,
        @QueryParam("bckyf") Integer bckyf, @QueryParam("abc02") String abc02,@QueryParam("bdm01") String bdm01, @QueryParam("bdp02") String bdp02,
        @QueryParam("vaf58") Integer vaf58,@QueryParam("lBBX09") Integer lBBX09,@QueryParam("currPage") int currPage, @QueryParam("pageSize") int pageSize)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lACF01", lACF01);
        map.put("lBDO01", lBDO01);
        map.put("lSql", lSql);
        map.put("lBDA01", lBDA01);
        map.put("lBCK01", lBCK01);
        map.put("bckyf", bckyf);
        map.put("abc02", abc02);
        map.put("bdp02", bdp02);
        map.put("vaf58", vaf58);
        map.put("lBBX09", lBBX09);
        map.put("bdm01", bdm01);
        map.put("yiyuanId", yiyuanId);
        return doctorAdviceEditor.medTreeToDetail(map, currPage, pageSize);
    }
    
    /* ScriptId(1755) */
    /* Description(医嘱编辑提取对应医嘱的收费明细 适用于药品医嘱) */
    /**
     * 
     * @param lVAF06 就诊id
     * @param lBBY01 收费项目id
     * @param lVAF21
     * @param ACF01
     * @param BDA01
     * @param lVAF22
     * @param BCK01
     * @param lBCK03
     * @param ABC02
     * @param vaf22b
     * @param aDate
     * @param VAF17
     * @param VAF18
     * @param VAF26
     * @param VAF27
     * @param VAF28
     * @param VAF29
     * @param vaj23
     * @param vaj26
     * @param vaj27
     * @param vaf58
     * @param Compound
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("querymedicineadvicefeedetail")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo queryMedicineAdviceFeeDetail(@FormParam("lVAF06") long lVAF06, @FormParam("lBBY01") int lBBY01,
        @FormParam("lVAF21") String lVAF21, @FormParam("ACF01") int ACF01, @FormParam("BDA01") String BDA01,
        @FormParam("lVAF22") String lVAF22, @FormParam("BCK01") int BCK01, @FormParam("lBCK03") String lBCK03,
        @FormParam("ABC02") String ABC02, @FormParam("vaf22b") String vaf22b, @FormParam("aDate") String aDate,
        @FormParam("VAF17") int VAF17, @FormParam("VAF18") String VAF18, @FormParam("VAF26") String VAF26,
        @FormParam("VAF27") int VAF27, @FormParam("VAF28") int VAF28, @FormParam("VAF29") String VAF29,
        @FormParam("vaj23") int vaj23, @FormParam("vaj26") int vaj26, @FormParam("vaj27") int vaj27,
        @FormParam("vaf58") int vaf58, @FormParam("Compound") int Compound)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lVAF06", lVAF06);
        map.put("lBBY01", lBBY01);
        map.put("lVAF21", lVAF21);
        map.put("ACF01", ACF01);
        map.put("BDA01", BDA01);
        map.put("lVAF22", lVAF22);
        map.put("BCK01", BCK01);
        map.put("lBCK03", lBCK03);
        map.put("ABC02", ABC02);
        map.put("vaf22b", vaf22b);
        map.put("aDate", aDate);
        map.put("VAF17", VAF17);
        map.put("VAF18", VAF18);
        map.put("VAF26", VAF26);
        map.put("VAF27", VAF27);
        map.put("VAF28", VAF28);
        map.put("VAF29", VAF29);
        map.put("vaj23", vaj23);
        map.put("vaj26", vaj26);
        map.put("vaj27", vaj27);
        map.put("vaf58", vaf58);
        map.put("aDate", new SimpleDateFormat("YYYY-MM-dd").format(new Date()));
        map.put("Compound", Compound);
        return doctorAdviceEditor.queryMedicineAdviceFeeDetail(map);
    }
    
    /* ScriptId(1760) */
    /* Description(门诊未发送临嘱计价内容：检查) */
    @SuppressWarnings("unchecked")
    @POST
    @Path("unsendadvicevaluationprice")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo unSendAdviceValuationPrice(@FormParam("lVAFID") int lVAFID, @FormParam("aDate") String aDate)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lVAFID", lVAFID);
        map.put("aDate", aDate);
        return doctorAdviceEditor.unSendAdviceValuationPrice(map);
    }
    
    /* ScriptId(1451) */
    /* Description(医嘱分类明细项目检索，分类检索，按输入条件) */
    /**
     * 
     * @param lBDO01 医疗项目id
     * @param lACF01
     * @param lSql 关键字
     * @param lBBX09 医疗项目目录id
     * @param lBEH01 诊疗项目编码
     * @param lBCE01 执行医师id
     * @param lBCK01 科室id
     * @param abc02 费别
     * @param bdp02 类型
     * @param lDate
     * @param gparam60
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("queryitemcondition")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo queryItemCondition(@FormParam("lBDO01") int lBDO01, @FormParam("lACF01") int lACF01,
        @FormParam("lSql") String lSql, @FormParam("lBBX09") int lBBX09, @FormParam("lBEH01") String lBEH01,
        @FormParam("lBCE01") Long lBCE01, @FormParam("lBCK01") Long lBCK01, @FormParam("abc02") String abc02,
        @FormParam("bdp02") String bdp02, @FormParam("lDate") String lDate, @FormParam("gparam60") String gparam60,
        @FormParam("currPage") int currPage, @FormParam("pageSize") int pageSize
    
    )
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lBDO01", lBDO01);
        map.put("lACF01", lACF01);
        map.put("lSql", "%" + lSql + "%");
        map.put("lBBX09", lBBX09);
        map.put("lBEH01", lBEH01);
        map.put("lBCE01", lBCE01);
        map.put("lBCK01", lBCK01);
        map.put("abc02", abc02);
        map.put("bdp02", bdp02);
        map.put("lDate", lDate);
        map.put("gparam60", gparam60);
        return doctorAdviceEditor.queryItemCondition(map, (currPage - 1) * pageSize, pageSize);
    }
    
    /* ScriptId(1754) */
    /* Description(用于医嘱编辑窗口，显示对应处方的收费明细) */
    /**
     * 
     * @param lVAF01 医疗项目id
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("queryBBY1ByVAF01")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo queryBBY1ByVAF01(@FormParam("lVAF01") String lVAF01)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lVAF01", lVAF01);
        return doctorAdviceEditor.queryBBY1ByVAF01(map);
    }
    
    /* ScriptId(6427) */
    /* Description(修改检查处方时，提取对应检查申请信息) */
    /**
     * 
     * @param lCBM01 医嘱单ID
     * @return
     * @throws Exception
     */
    @SuppressWarnings("unchecked")
    @POST
    @Path("queryBBY1ByVAF01")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo queryVBQ1ByCBM01(@FormParam("lCBM01") String lCBM01)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("lCBM01", lCBM01);
        return doctorAdviceEditor.queryVBQ1ByCBM01(map);
    }
    
    @GET
    @Path("yangben")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo queryYangben()
        throws Exception
    {
        HashMap map = new HashMap();
        
        //加载redis数据
//        return redisResource.getRedisModelVo("abb1");
        //加载数据库数据
        return doctorAdviceEditor.queryYangben(map);
    }
    
    @GET
    @Path("getVaf1Byvaf01a")
    @Produces({MediaType.APPLICATION_JSON})
    public ModelVo getVaf1Byvaf01a(@QueryParam("vaf01") long vaf01,@QueryParam("yiyuanId") long yiyuanId)
        throws Exception
    {
        HashMap map = new HashMap();
        map.put("vaf01", vaf01);
        map.put("yiyuanId", yiyuanId);
        return doctorAdviceEditor.getVaf1Byvaf01a(map);
    }
}
